import { ref, onMounted, onUnmounted } from 'vue';

export function useMousePosition() {
  const mouseX = ref(0);
  const mouseY = ref(0);

  const handleMouseMove = (event) => {
    mouseX.value = event.touches[0].clientX;
    mouseY.value = event.touches[0].clientY;
  };

  onMounted(() => {
    window.addEventListener('touchmove', handleMouseMove);
  });

  onUnmounted(() => {
    window.removeEventListener('touchmove', handleMouseMove);
  });

  return {
    mouseX,
    mouseY
  };
}
